<?php
Yii::import('ext.bootstrap.widgets.TbBreadcrumbs');
class MyBreadcrumbs extends TbBreadcrumbs{

	/**
	 *### .init()
	 *
	 * Initializes the widget.
	 */
	public $separator = '/';
	public function init()
	{
		
		if (isset($this->htmlOptions['class'])) {
			$this->htmlOptions['class'] .= ' breadcrumb';
		} else {
			$this->htmlOptions['class'] = 'breadcrumb';
		}
		//$this->htmlOptions['style'] = 'background: #0099CC !important; color: white;';
		// apply bootstrap style
		$this->separator = '<span class="divider">' . $this->separator . '</span>';
	}

	/**
	 *### .run()#0099CC
	 *
	 * Renders the content of the widget.
	 *
	 * @throws CException
	 */
	public function run()
	{
		// Hide empty breadcrumbs.
		if (empty($this->links)) {
			return;
		}

		$links = '';

		if (!isset($this->homeLink)) {
			$content = CHtml::link( '<i class="icon-home"> </i>'.Yii::t('zii', 'Home'), Yii::app()->homeUrl);
			$links .= $this->renderItem($content);
		} else if ($this->homeLink !== false) {
			$links .= $this->renderItem($this->homeLink);
		}

		$count = count($this->links);
		$counter = 0;
		foreach ($this->links as $label => $url) {
			++$counter; // latest is the active one
			if (is_string($label) || is_array($url)) {
				$content = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
				$links .= $this->renderItem($content);
			} else {
				$links .= $this->renderItem(
					$this->encodeLabel ? CHtml::encode($url) : $url,
					($counter === $count)
				);
			}
		}

		echo CHtml::tag('ul', $this->htmlOptions, $links);
	}
}

?>